package demo2;

import java.util.List;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * @Author liangzai
 * @Description:
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = 0;
        int left = scanner.nextInt();
        int right = scanner.nextInt();
        for (int i = left; i <= right; i++) {
            int a = i;
            while(a!=0){
                if(a%10==2){
                    count++;
                }
                a /= 10;
            }
        }
        System.out.println(count);
    }

    //求两个数组的交集
    public ArrayList<Integer> intersection (ArrayList<Integer> nums1, ArrayList<Integer> nums2) {
        // write code here
        ArrayList<Integer> list = new ArrayList();
        for (int i = 0; i < nums1.size(); i++) {
            for (int j = 0; j < nums2.size(); j++) {
                if(nums1.get(i).equals(nums2.get(j))){
                    list.add(nums1.get(i));
                    nums2.remove(nums2.get(j));
                }
            }
        }
        return list;
    }
}
